function func(b)
a=b-1
return(a)
end

function checkGuess(guessNum)
	repeat
		print("Is it ", guessNum)
		--{
		i=io.read()
		if(i=="y") then
		--{
			return true
		--}
		elseif(i=="n")then 
		--{
			return false
		--}
		end-- end of if
		print("Thats not an answer")
	until false
end

function computerGuesses(currNum)
	local guess =math.floor(currNum)
	--{
	if(checkGuess(guess)==true)then
		return true
	end

	print("Is it higher or lower? (h/l)")
	repeat
		input=io.read()
		if(input=="h") then
			num=(maxNum-guess)/2
			computerGuesses(guess+num)
		elseif(input=="l")then
			computerGuesses(guess/2)
		end
		print("Thats not an answer")
	until false
	--}end of repeat
end
--}

function main()
	print("Welcome. Want to play?")
	repeat
		i=io.read()
		os.execute("cls")

		if(i=="y") then
			break
		elseif(i=="n")then
			return(nil)
		end

	until true

	repeat 
		maxNum=100
		curNum=maxNum/2
		print("Think of your secret number. Between 1 and 100")
		if(computerGuesses(curNum))then
			print("Wooo, I win")
			return
		end

	until false``````````````````````````````````````````````````````````````````````````
	
end




main()
